<?php

namespace app\model;

use Carbon\Carbon;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use support\Model;

/**
 * lattice_room_device 
 * @property integer $id (主键)
 * @property string $room_name 名字
 * @property string $device_name 用户
 * @property string $ip 密码
 * @property string $mac 密码
 * @property mixed $updated_at 
 * @property mixed $created_at
 */
class RoomDevice extends Model
{
    use HasFactory;

    protected $table = 'room_device';

    protected $guarded = [];


    public function getCreatedAtAttribute($value)
    {
        return Carbon::parse($value)->toDateTimeString();
    }


    /**
     * 为数组 / JSON 序列化准备日期。
     *
     * @param  \DateTimeInterface  $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }
    
}
